package com.zik.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.CellData;

import java.util.Map;

/**
 * @author: zik_zhou
 * @Date: 2023-05-02 15:20
 * @Operation:
 * @Description: 监听
 **/
public class ExcelListener extends AnalysisEventListener<User> {
    // 一行行读取excel内容
    // 从第二行开始读取

    @Override
    public void invoke(User user, AnalysisContext analysisContext) {
        System.out.println(user);

    }

    /**
     * 读取表头
     * @param headMap
     * @param context
     */
    @Override
    public void invokeHead(Map<Integer, CellData> headMap, AnalysisContext context) {
        System.out.println("表头:" + headMap);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
